package com.herench.bunch.clinic.handler;

import com.herench.bunch.clinic.convert.AppointConvert;
import com.herench.bunch.clinic.support.AbstractClinicMessageHandler;
import com.herench.bunch.commons.annotation.Handler;
import com.herench.bunch.commons.support.WsClientFactory;
import org.apache.cxf.endpoint.Client;
import org.dom4j.Document;
import org.slf4j.LoggerFactory;

import java.util.logging.Logger;

@Handler(code = "200040", name = "患者预约挂号(S007)" ,messageConvertClass = AppointConvert.class)
public class AppointHandlerClinic extends AbstractClinicMessageHandler {
    @Override
    protected Object proxyInvoke(Object inMessage) throws Exception {
        Document message = (Document) inMessage;

        Client client = WsClientFactory.getInstance().getWsClient(ProxyMsgCodeConstant.HIS_YY_URL);
        Object[] res = client.invoke(ProxyMsgCodeConstant.HIS_YY_DEFAULT_OPEARTION, message.asXML());
        return  res[0];
    }
}
